// 广场相关接口
import { get, post } from '../base/request'

// 获取轮播图
export const getBannerList = () => get('/api/plaza/banner')

// 获取文章分类
export const getArticleCategoryList = () => get('/api/plaza/category')

// 获取文章列表
export const getArticleList = (data) => get('/api/plaza/article', data)

// 获取文章详情
export const getArticleDetail = (article_id) => get('/api/plaza/detail', { article_id })

// 获取文章评论列表
export const getArticleCommentList = (article_id) => get('/api/plaza/comment_list', { article_id })

// 评论点赞/取消点赞
export const postArticleCommentToggleLike = (comment_id, isLike) => {
  return isLike ? postArticleCommentCancelLike(comment_id): postArticleCommentLike(comment_id)
}

// 文章分享统计
export const postArticleShareStatistics = (article_id) => post('/api/plaza/share', { article_id })

// 点赞评论
export const postArticleCommentLike = (comment_id) => post('/api/plaza/give_like', null, { comment_id })

// 取消点赞评论
export const postArticleCommentCancelLike = (comment_id) => post('/api/plaza/cancel_like', null, { comment_id })

// 发表评论
export const postArticleCommentAdd = (article_id, content) => post('/api/plaza/comment_add', { article_id, content }) 

// 举报评论
export const postArticleCommentTipOff = (data) => post('/api/plaza/tip_off', data) 

// 线上课程 - 获取线上课程分类列表
export const getOnlineCourseCategoryList = () => get('/api/curriculum/category') 

// 线上课程 - 获取线上课程推荐列表
export const getOnlineRecommendCourseList = (page) => get('/api/curriculum/recommend', page) 

// 线上课程 - 获取线上课程列表
export const getOnlineCourseList = (data) => get('/api/curriculum/lists', data) 

// 线上课程 - 获取线上课程详情
export const getOnlineCourseDetail = (class_id) => get('/api/curriculum/detail', { class_id }) 

// 线上课程 - 购买线上课程
export const postOnlineCourseBuy = (class_id) => post('/api/curriculum/buy', { class_id }) 

// 线上课程 - 保存进度
export const postOnlineCourseSaveProgress = (data) => post('/api/curriculum/save_progress', data) 

// 线上课程 - 获取学习心得
export const getOnlineCourseStudyNote = (class_id, user_id) => get('/api/curriculum/study_note', { class_id, user_id }) 

// 线上课程 - 保存学习心得
export const postOnlineCourseStudyNoteAdd = (data) => post('/api/curriculum/profile_study_note', data) 

// 线下课程 - 获取线下课程列表
export const getOfflineCourseList = (data) => get('/api/course/lists', data) 

// 线下课程 - 获取线下课程详情
export const getOfflineCourseDetail = (class_id) => get('/api/course/detail', { class_id }) 

// 线下课程 - 预约课程
export const postOfflineCourseApply = (data) => post('/api/course/apply', data) 

// 直播详情
export const getLiveDetail = (live_id) => get('/api/live/detail', { live_id }) 

// 直播预约
export const postLiveApply = (data) => post('/api/live/apply', data)

// 直播取消预约
export const postLiveCancel = (data) => post('/api/live/cancel', data)